#include "eanimation.h"

EAnimation::EAnimation() :
    m_bFinished(false),
    m_bPaused(false),
    m_bLoop(false)
{
}

void EAnimation::play()
{
    m_bPaused = false;
}

void EAnimation::pause()
{
    m_bPaused = true;
}

bool EAnimation::isPaused() const
{
    return m_bPaused;
}

void EAnimation::setLoop(bool bLoop)
{
    m_bLoop = bLoop;
}

bool EAnimation::isLoop() const
{
    return m_bLoop;
}

bool EAnimation::isFinished() const
{
    return m_bFinished;
}

void EAnimation::setFinished(bool bFinished)
{
    if(m_bFinished == bFinished) return;

    m_bFinished = bFinished;

    if(!m_bFinished)
    {
        // do nothing
    }
    else if(m_bLoop)
    {
        emit loopFinished();
        reset();
    }
    else
    {
        emit finished();
    }
}

void EAnimation::enter()
{

}

void EAnimation::exit()
{
    reset();
}
